﻿#ifndef STATION_H
#define STATION_H

#include <QWidget>
#include <QTimer>

class Station : public QWidget
{
    Q_OBJECT
public:
    explicit Station(QWidget *parent = nullptr);

    void setInterval(quint16 interval);
    void setTitle(QString str);
    void setStation(QString str);
    void setFontPixelSize(quint8 size);

public slots:
    void refresh();


protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);
    void initParam();
    void drawTitle(QPainter *pPainter);
    void drawStation(QPainter *pPainter);

signals:

private:
    QTimer mTimer;
    QRect mTitleRect;
    QRect mStationRect;
    quint8 mTitleWidthProportion = 35;
    QString mTitleStr = QString("");
    QString mStationStr = QString("");
//    QColor mColor = QColor(37, 151, 230);
//    QString mFontFace = QString("微软雅黑");
    quint8 mFontPixelSize = 18;                                              // 字体像素大小
    quint8 mRowSpace = 10;
};

#endif // STATION_H
